package sg.edu.nus.iss.vmcs.store;
import java.util.*;
public class CoinValueComparator implements Comparator{
	public int compare(Object obj1, Object obj2) {
		if (obj1 instanceof StoreItem && obj2 instanceof StoreItem) {
			StoreItem cashStoreItem1 = (StoreItem) obj1;
			StoreItem cashStoreItem2 = (StoreItem) obj2;
			
			int result=((Coin)cashStoreItem2.getContent()).getValue()-((Coin)cashStoreItem1.getContent()).getValue();
			
			return result;
		}
		
		System.out.println("CoinValueComparator.compare: unknown objects");
		return -1;
	}
}
